/*
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// This file is automatically generated. Do not modify it.
package com.xayah.databackup.ui.theme.color.scheme

import com.xayah.databackup.ui.theme.color.palettes.CorePalette

/**
 * Represents a Material color scheme, a mapping of color roles to colors.
 *
 * @deprecated Please use dynamiccolor.DynamicScheme instead.
 *   Refer to
 *   https://github.com/material-foundation/material-color-utilities/blob/main/make_schemes.md for
 *   migration guidance.
 */
@Deprecated(
    "Please use dynamiccolor.DynamicScheme instead. Refer to https://github.com/material-foundation/material-color-utilities/blob/main/make_schemes.md for migration guidance."
)
data class Scheme(
    var primary: Int = 0,
    var onPrimary: Int = 0,
    var primaryContainer: Int = 0,
    var onPrimaryContainer: Int = 0,
    var secondary: Int = 0,
    var onSecondary: Int = 0,
    var secondaryContainer: Int = 0,
    var onSecondaryContainer: Int = 0,
    var tertiary: Int = 0,
    var onTertiary: Int = 0,
    var tertiaryContainer: Int = 0,
    var onTertiaryContainer: Int = 0,
    var error: Int = 0,
    var onError: Int = 0,
    var errorContainer: Int = 0,
    var onErrorContainer: Int = 0,
    var background: Int = 0,
    var onBackground: Int = 0,
    var surface: Int = 0,
    var onSurface: Int = 0,
    var surfaceVariant: Int = 0,
    var onSurfaceVariant: Int = 0,
    var outline: Int = 0,
    var outlineVariant: Int = 0,
    var shadow: Int = 0,
    var scrim: Int = 0,
    var inverseSurface: Int = 0,
    var inverseOnSurface: Int = 0,
    var inversePrimary: Int = 0,
) {

    companion object {
        /** Creates a light theme Scheme from a source color in ARGB, i.e. a hex code. */
        @JvmStatic
        fun light(argb: Int): Scheme {
            return lightFromCorePalette(CorePalette.Companion.of(argb))
        }

        /** Creates a dark theme Scheme from a source color in ARGB, i.e. a hex code. */
        @JvmStatic
        fun dark(argb: Int): Scheme {
            return darkFromCorePalette(CorePalette.Companion.of(argb))
        }

        /** Creates a light theme content-based Scheme from a source color in ARGB, i.e. a hex code. */
        @JvmStatic
        fun lightContent(argb: Int): Scheme {
            return lightFromCorePalette(CorePalette.Companion.contentOf(argb))
        }

        /** Creates a dark theme content-based Scheme from a source color in ARGB, i.e. a hex code. */
        @JvmStatic
        fun darkContent(argb: Int): Scheme {
            return darkFromCorePalette(CorePalette.Companion.contentOf(argb))
        }

        private fun lightFromCorePalette(core: CorePalette): Scheme {
            return Scheme(
                primary = core.a1.tone(40),
                onPrimary = core.a1.tone(100),
                primaryContainer = core.a1.tone(90),
                onPrimaryContainer = core.a1.tone(10),
                secondary = core.a2.tone(40),
                onSecondary = core.a2.tone(100),
                secondaryContainer = core.a2.tone(90),
                onSecondaryContainer = core.a2.tone(10),
                tertiary = core.a3.tone(40),
                onTertiary = core.a3.tone(100),
                tertiaryContainer = core.a3.tone(90),
                onTertiaryContainer = core.a3.tone(10),
                error = core.error.tone(40),
                onError = core.error.tone(100),
                errorContainer = core.error.tone(90),
                onErrorContainer = core.error.tone(10),
                background = core.n1.tone(99),
                onBackground = core.n1.tone(10),
                surface = core.n1.tone(99),
                onSurface = core.n1.tone(10),
                surfaceVariant = core.n2.tone(90),
                onSurfaceVariant = core.n2.tone(30),
                outline = core.n2.tone(50),
                outlineVariant = core.n2.tone(80),
                shadow = core.n1.tone(0),
                scrim = core.n1.tone(0),
                inverseSurface = core.n1.tone(20),
                inverseOnSurface = core.n1.tone(95),
                inversePrimary = core.a1.tone(80),
            )
        }

        private fun darkFromCorePalette(core: CorePalette): Scheme {
            return Scheme(
                primary = core.a1.tone(80),
                onPrimary = core.a1.tone(20),
                primaryContainer = core.a1.tone(30),
                onPrimaryContainer = core.a1.tone(90),
                secondary = core.a2.tone(80),
                onSecondary = core.a2.tone(20),
                secondaryContainer = core.a2.tone(30),
                onSecondaryContainer = core.a2.tone(90),
                tertiary = core.a3.tone(80),
                onTertiary = core.a3.tone(20),
                tertiaryContainer = core.a3.tone(30),
                onTertiaryContainer = core.a3.tone(90),
                error = core.error.tone(80),
                onError = core.error.tone(20),
                errorContainer = core.error.tone(30),
                onErrorContainer = core.error.tone(80),
                background = core.n1.tone(10),
                onBackground = core.n1.tone(90),
                surface = core.n1.tone(10),
                onSurface = core.n1.tone(90),
                surfaceVariant = core.n2.tone(30),
                onSurfaceVariant = core.n2.tone(80),
                outline = core.n2.tone(60),
                outlineVariant = core.n2.tone(30),
                shadow = core.n1.tone(0),
                scrim = core.n1.tone(0),
                inverseSurface = core.n1.tone(90),
                inverseOnSurface = core.n1.tone(20),
                inversePrimary = core.a1.tone(40),
            )
        }
    }
}
